JavaScript: The Good Parts: The Good Parts by Douglas Crockford
Author:Douglas Crockford [Crockford, Douglas]
Language: eng
Format: epub, pdf
Tags: COMPUTERS / Programming Languages / JavaScript
ISBN: 9780596158736
Publisher: O'Reilly Media
Published: 2008-05-08T07:00:00+00:00
Regexp Escape
The backslash character indicates escapement in regexp factors as well as in strings, but in regexp factors, it works a little differently.
As in strings, \f is the formfeed character, \n is the newline character, \r is the carriage return character, \t is the tab character, and \u allows for specifying a Unicode character as a 16-bit hex constant. In regexp factors, \b is not the backspace character.
\d is the same as [0-9]. It matches a digit. \D is the opposite: [^0-9].
\s is the same as [\f\n\r\t\u000B\u0020\u00A0\u2028\u2029]. This is a partial set of Unicode whitespace characters. \S is the opposite: [^\f\n\r\t\u000B\u0020\u00A0\u2028\u2029].
\w is the same as [0-9A-Z_a-z]. \W is the opposite: [^0-9A-Z_a-z]. This is supposed to represent the characters that appear in words. Unfortunately, the class it defines is useless for working with virtually any real language. If you need to match a class of letters, you must specify your own class.
A simple letter class is [A-Za-z\u00C0-\u1FFF\u2800-\uFFFD]. It includes all of Unicode’s letters, but it also includes thousands of characters that are not letters. Unicode is large and complex. An exact letter class of the Basic Multilingual Plane is possible, but would be huge and inefficient. JavaScript’s regular expressions provide extremely poor support for internationalization.
\b was intended to be a word-boundary anchor that would make it easier to match text on word boundaries. Unfortunately, it uses \w to find word boundaries, so it is completely useless for multilingual applications. This is not a good part.
\1 is a reference to the text that was captured by group 1 so that it can be matched again. For example, you could search text for duplicated words with:
var doubled_words = /([A-Za-z\u00C0-\u1FFF\u2800-\uFFFD]+)\s+\1/gi;
doubled_words looks for occurrences of words (strings containing 1 or more letters) followed by whitespace followed by the same word.
\2 is a reference to group 2, \3 is a reference to group 3, and so on.
Download
JavaScript: The Good Parts: The Good Parts by Douglas Crockford.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Coding Theory | Localization |
Logic | Object-Oriented Design |
Performance Optimization | Quality Control |
Reengineering | Robohelp |
Software Development | Software Reuse |
Structured Design | Testing |
Tools | UML |
Deep Learning with Python by François Chollet(12566)
Hello! Python by Anthony Briggs(9911)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9795)
The Mikado Method by Ola Ellnestam Daniel Brolund(9775)
Dependency Injection in .NET by Mark Seemann(9336)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8293)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7758)
Grails in Action by Glen Smith Peter Ledbrook(7693)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7028)
Microservices with Go by Alexander Shuiskov(6795)
Practical Design Patterns for Java Developers by Miroslav Wengner(6707)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6649)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6409)
Angular Projects - Third Edition by Aristeidis Bampakos(6055)
The Art of Crafting User Stories by The Art of Crafting User Stories(5587)
NetSuite for Consultants - Second Edition by Peter Ries(5520)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5324)
Kotlin in Action by Dmitry Jemerov(5062)
